{% extends 'ProjResManBundle::layout.html.twig' %}

{% block header_menu_login_href %}{% if template_content.auth.isAuth == false %}{{ template_content.header.menu.login }}{% else %}{{ template_content.header.menu.logout }}{% endif %}{% endblock %}
{% block header_menu_login_text %}{% if template_content.auth.isAuth == false %}{{ template_content.header.text.login }}{% else %}{{ template_content.header.text.logout }}{% endif %}{% endblock %}
{% block header_menu_login_user %}{% if template_content.auth.isAuth == true %}{{ template_content.auth.user }}{% endif %}{% endblock %}
{% block header_menu_login_message %}{% if template_content.auth.isAuth == true %}User:{% endif %}{% endblock %}
{% block content %}
<div id="page_content">
    <div id="submenu">
        <div id="submenu_float1">
            <div id="submenu_float2">
                <ul>
                    {% block submenu -%}
                    {% for item in template_content.content.submenu %}
                    <ul class="submenu_option">
                        <a href={{ item.href }}>
                        <li class="submenu_header">{{ item.title }}</li>
                        <li class="submenu_details">{{ item.title_desc }}</li>
                    </a>
                    </ul>
                    {% endfor %}
                    {% endblock %}
                </ul>
            </div>
        </div>
    </div>
        
    <div id="container">
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>Nume</th>
                    <th>Data inceperii</th>
                    <th>Data finalizarii</th>
                    <th>Aprobat</th>
                </tr>
            </thead>
            <tbody>
                {% for project in projects %}
                    <tr>
                        <td>{{ project.name }}</td>
                        <td>{{ project.startDate.format('Y-m-d') }}</td>
                        <td>{{ project.endDate.format('Y-m-d') }}</td>
                        <td>
                            {% if project.approved == 1 %}
                                Da
                            {% else %}
                                Nu
                            {% endif %}
                        </td>
                        
                        <td>
                            <a href="{{ path('department_add_activity', {"id": project.id}) }}">
                                <button type="button" class="btn btn-info">Adauga activitate</button>
                            </a> 
                        </td>
                       
                        </tr>
                      
                {% endfor %}
            </tbody>
        </table>
        {% if template_content.auth.isAuth == true %}
            <a style="text-decoration: none;" href="{{ path('department_projects_add') }}">
                <button type="submit" class="btn btn-info" style="margin-left:auto;margin-right:auto;display:block;margin-bottom:20px;">Adauga proiect nou</button>
            </a>
        {% endif %}
    </div>
</div>
{% endblock %}
